from typing import Union, List, Tuple

import pandas as pd


class Excel:
    def __init__(self, filename: str, header=0, **kwargs):
        self.dataFrame = pd.read_excel(filename, header=header, dtype={'速度(KM/H)': str}, **kwargs)

    def to_dict(self):
        return self.dataFrame.to_dict(orient='records')

    def getHeaders(self):
        return list(self.dataFrame.columns)

    def getColumnsData(self, columns: List[str]) -> List[Union[str, Tuple, list]]:
        """
        获取指定的列数据
        :return:
        """
        columnList = [self.dataFrame[column].values for column in columns]
        new_columnList = zip(*columnList)
        return list(new_columnList)
